package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Seeker;
import com.ruoyi.system.service.ISeekerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 求职者信息管理Controller
 * 
 * @author ruoyi
 * @date 2024-05-22
 */
@RestController
@RequestMapping("/system/seeker")
public class SeekerController extends BaseController
{
    @Autowired
    private ISeekerService seekerService;

    /**
     * 查询求职者信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:seeker:list')")
    @GetMapping("/list")
    public TableDataInfo list(Seeker seeker)
    {
        startPage();
        List<Seeker> list = seekerService.selectSeekerList(seeker);
        return getDataTable(list);
    }

    /**
     * 导出求职者信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:seeker:export')")

    @PostMapping("/export")
    public void export(HttpServletResponse response, Seeker seeker)
    {
        List<Seeker> list = seekerService.selectSeekerList(seeker);
        ExcelUtil<Seeker> util = new ExcelUtil<Seeker>(Seeker.class);
        util.exportExcel(response, list, "求职者信息管理数据");
    }

    /**
     * 获取求职者信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:seeker:query')")
    @GetMapping(value = "/{seekerId}")
    public AjaxResult getInfo(@PathVariable("seekerId") Long seekerId)
    {
        return success(seekerService.selectSeekerBySeekerId(seekerId));
    }

    /**
     * 新增求职者信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:seeker:add')")

    @PostMapping
    public AjaxResult add(@RequestBody Seeker seeker)
    {
        return toAjax(seekerService.insertSeeker(seeker));
    }

    /**
     * 修改求职者信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:seeker:edit')")

    @PutMapping
    public AjaxResult edit(@RequestBody Seeker seeker)
    {
        return toAjax(seekerService.updateSeeker(seeker));
    }

    /**
     * 删除求职者信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:seeker:remove')")

	@DeleteMapping("/{seekerIds}")
    public AjaxResult remove(@PathVariable Long[] seekerIds)
    {
        return toAjax(seekerService.deleteSeekerBySeekerIds(seekerIds));
    }
}
